﻿@model BetterTaskList.Models.Ticket

@{
    ViewBag.Title = "Details";
    Layout = "~/Views/Shared/_ContentSideBar.cshtml";
}

<div id="content">

    <h2>Ticket #@Model.TicketId - @Model.TicketSubject</h2>
    
    <div class="post-info">
        <span title="@Model.TicketLastUpdated" >@Model.TicketCreatedDate.Value.ToString("F")</span>  by 
        <span>
            <span>
                <a href="#" id="toggle-author-box">@BetterTaskList.Helpers.UserHelpers.GetUserFullName(Model.TicketCreatorUserId) </a> 
                @* @Html.ActionLink(BetterTaskList.Helpers.UserHelpers.GetUserFullName(Model.TicketCreatorUserId), "Profile", "Home", new { area = "", id = Model.TicketCreatorUserId }, new { @Style = "text-decoration:none" })*@
                @Html.Partial("_DisplayTicketDueDate")
            </span>
        </span>
    </div>

    <div id="author-box" style="display:none;" class="author-box">
        <div>
            <img height="64" width="64" class="avatar" src="@Url.Content(BetterTaskList.Helpers.UserHelpers.GetUserAvatarUrl(Model.TicketCreatorUserId, "64x64"))" title="" alt="" />
            <strong>About the ticket creator (@BetterTaskList.Helpers.UserHelpers.GetUserFullName(Model.TicketCreatorUserId))</strong>
            <br />
            @Html.Raw(BetterTaskList.Helpers.UserHelpers.GetUserProfile(Model.TicketCreatorUserId).AboutMe)
        </div>
    </div>

    <div class="entry-content">
            @Html.Raw(Model.TicketDescription)
    </div>

    @if (Model.TicketStatus == "CLOSED")
    {
    <div class="entry-content" style="background-color:#FCF0BA; border:1px solid #E8E1B5;">
            @Html.Partial("_DisplayTicketResolution")
    </div>
    }
    
    <div class="clear"></div>

    <div class="post-info" style="text-align:right">
        @Html.ActionLink("Edit", "Edit", new { id = Model.TicketId }) |
        @Html.ActionLink("Delete", "Delete", new { id = Model.TicketId })
        or
        <a style="cursor:pointer;" id="toggle-resolve-ticket">Resolve</a>
    </div>


    <div class="clear"></div>

    <div id="resolve-ticket" style="display:none;">
    <h3>Ticket Resolution</h3>
    <div id="tabs">
	    <ul>
		    <li><a href="#tabs-1">Details</a></li>
            <li><a href="#tabs-2">Resolution Attachment</a></li>
	    </ul>
	    <div id="tabs-1">
                @Html.Partial("_TicketResolution")
	    </div>

        <div id="tabs-2">
             <div style="width:558px; font-size:12px;">
                @Html.Partial("_FileUploader")
             </div>
	    </div>

    </div>
    </div>

    <div class="clear"></div>

    @Html.Partial("_DisplayComment")

    <div id="submit-comment">
        <h3>Comment or attach a file</h3>
        <div id="commentTab">
        <ul>
             <li><a href="#comment-tab">Comment</a></li>
             <li><a href="#attachment-tab">Comment Attachment</a></li>
        </ul>
        <div id="comment-tab">
            @Html.Partial("_PostComment")
        </div>

        <div id="attachment-tab">
                <div style="width:558px; font-size:12px;">
                      @Html.Partial("_SideBarFileUploader")
                </div>
	    </div>

    </div>
    </div>

</div>

<div id="sidebar" class="sidebar widget-area">
    <div style="width:269px;">@Html.Partial("_TicketAttachments")</div>
</div>

<script src="@Url.Content("~/Scripts/tiny_mce/tiny_mce.js")" type="text/javascript"></script>
<script type="text/javascript">
    tinyMCE.init({
        mode: "textareas",
        width: "558",
        theme: "advanced",
        theme_advanced_buttons1: "mymenubutton,bold,italic,underline,separator,strikethrough,justifyleft,justifycenter,justifyright,justifyfull,bullist,numlist,outdent,indent,undo,redo,link,unlink",
        theme_advanced_buttons2: "",
        theme_advanced_buttons3: "",
        theme_advanced_toolbar_location: "top",
        theme_advanced_toolbar_align: "left",
        theme_advanced_statusbar_location: "bottom"

    });
</script>

<script type="text/javascript">
    $(function () {
        $("#tabs").tabs();
        $("#commentTab").tabs();
        $("#SubmitComment").button();
        $("#SubmitResolution").button();
        $("#SubmitComment").button();

        $("#toggle-resolve-ticket").click(function () {
            $("#resolve-ticket").toggle("highlight", null, 500);
            $("#submit-comment").toggle("higlight", null, 500);
            return false;
        });

        $("#toggle-author-box").click(function () {
            $("#author-box").toggle("highlight", null, 500);
            return false;
        });

    });
</script>



